package cn.hx.fristgame;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;

public class gameUtil {
    private gameUtil(){ //私有化工具类
    }

    public static Image getImage(String path){ //返回指定路径的图片对象
        BufferedImage bi = null;
        try {
            URL u = gameUtil.class.getClassLoader().getResource(path);
            bi = ImageIO.read(u);
        }catch (IOException e){
            e.printStackTrace();
        }
        return bi;
    }
}
